//
//  NBLocationUtils.h
//  automobiledashboard
//
//  Created by 王建华 on 2025/9/26.
//

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import "ItineraryModel.h"

NS_ASSUME_NONNULL_BEGIN

@protocol NBLocationDelegate <NSObject>

@optional
- (void)locationManager:(CLLocationManager *)manager
     didUpdateLocations:(CLLocation *)location
       didUpdateHeading:(CLHeading *)newHeading;

@end

@interface NBLocationUtils : NSObject <CLLocationManagerDelegate>

@property (nonatomic, strong) CLLocationManager *locationManager;
@property (nonatomic, weak) id < NBLocationDelegate > delegate;

// 0 无修正 ； 1 90 ； 2 180 ； 3 270 ；
@property (nonatomic, assign) NSInteger correctDirection;

- (void)startUpdatingLocationAndHeading;
- (void)stopUpdatingLocationAndHeading;

/// 更新地图视角
/// - Parameters:
///   - mapview: 地图组件
///   - speed: 速度信息
+ (MKMapCamera *)updataCameraWithMapView:(MKMapView *)mapView
                                andSpeed:(CLLocationSpeed)speed
                              andHeading:(CLLocationDirection)heading;

/// 更新速度显示
/// - Parameter speed: 速度
+ (NSString *)updataSpeedStringFromSpeed:(CLLocationSpeed)speed;

@end

NS_ASSUME_NONNULL_END
